package com.zero.zui
{
	import com.zero.zinterface.IComponent;
	import com.zero.zsingleton.ComponentSingleton;
	
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.utils.Dictionary;
	
	public class ExtendTextField extends TextField implements IComponent
	{
		private static const Z_TEXT_FORMAT_STYLE:String				= "Z_TEXT_FORMAT_STYLE";

		protected var _attributeDic		:Dictionary;
		
		private var _format				:TextFormat;
		
		public var stylename				:String;

		public function ExtendTextField()
		{
			super();
			_attributeDic = new Dictionary();

		}
		
		public function set textFormatStyle($value:String):void
		{
			_format = ComponentSingleton.instance.model.getSet($value);
			
			attributeChange(Z_TEXT_FORMAT_STYLE);
		}
		
		public function attributeChange($styleName:String):void
		{
			_attributeDic[$styleName] = true;
			attributeUpdate();
			addChildren();
		}
		
		public function attributeUpdate():void
		{
			if(_attributeDic[Z_TEXT_FORMAT_STYLE])
			{
				setTextFormat(_format);
				defaultTextFormat = _format;
			}
		}
		
		public function addChildren():void
		{
			
		}
		
		public function dispose():void
		{
			
		}
	}
}